package com.ygqh.baby.service.task;

import java.util.List;

import com.ygqh.baby.model.wdt.qyb.PushOrderErrorInfo;
import com.ygqh.baby.utils.MailUtil;

public interface YgAsynCallBack {
	public void syncOrderCallBack(List<PushOrderErrorInfo> errorList);

	public void sendWxMsgCallBack(Boolean falg);

	public void syncPurchaseOrderCallBack(Boolean falg);

	void syncCommissionDetailCallBack(Boolean falg);

	default void sendMail(List<PushOrderErrorInfo> errorList, String to, MailUtil mailUtil, String title) {
		StringBuffer str = new StringBuffer();
		str.append("<html><head><style>.table-d table{ background:#000;font-size:14px} .table-d table td{ background:#FFF} h5{width: auto;margin-right: 20px} .title{display: flex;line-height: 10px}");
		str.append("</style></head><body>");
		str.append("<div class='title'><h5>" + title + "</h5></div>");
		str.append("<div class='table-d'>");
		str.append("<table width='800' border='0' cellspacing='1' cellpadding='0'><tr><td width='15%'>订单编号</td><td width='15%'>失败原因</td></tr>");
		for (PushOrderErrorInfo error : errorList) {
			str.append("<tr><td>" + error.getTid() + "</td>");
			str.append("<td>" + error.getError() + "</td>");
			str.append("</tr>");
		}
		try {
			System.out.println(str.toString());
			mailUtil.sendWithHtml(to.split(","), title, str.toString());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
